package com.zygvip.demand.entity;

import com.google.common.base.Objects;
import com.zygvip.demand.core.BaseEntity;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;

/**
 * Description
 *
 * @author 马乌提
 * @create 2018-02-01 15:20
 */
@Entity
@Table(name = "app_user", schema = "demand", catalog = "")
public class AppUser extends BaseEntity{

    private Integer id;
    private String mobile;
    private String openId;
    private String idcard;
    private String nickName;
    private Date birthday;
    private Byte sex;
    private String avatar;
    private Byte registerFrom;
    private Timestamp registerTime;
    private Timestamp loginTime;
    private Timestamp lastLoginTime;
    private String loginIp;
    private String lastLoginIp;
    private Byte loginFrom;
    private Integer loginNum;
    private Byte state;

    @Id
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Basic
    @Column(name = "open_id")
    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    @Basic
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }

    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }

    @Basic
    @Column(name = "nick_name")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Basic
    @Column(name = "birthday")
    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Basic
    @Column(name = "sex")
    public Byte getSex() {
        return sex;
    }

    public void setSex(Byte sex) {
        this.sex = sex;
    }

    @Basic
    @Column(name = "avatar")
    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    @Basic
    @Column(name = "register_from")
    public Byte getRegisterFrom() {
        return registerFrom;
    }

    public void setRegisterFrom(Byte registerFrom) {
        this.registerFrom = registerFrom;
    }

    @Basic
    @Column(name = "register_time")
    public Timestamp getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Timestamp registerTime) {
        this.registerTime = registerTime;
    }

    @Basic
    @Column(name = "login_time")
    public Timestamp getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Timestamp loginTime) {
        this.loginTime = loginTime;
    }

    @Basic
    @Column(name = "last_login_time")
    public Timestamp getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Timestamp lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    @Basic
    @Column(name = "login_ip")
    public String getLoginIp() {
        return loginIp;
    }

    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp;
    }

    @Basic
    @Column(name = "last_login_ip")
    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    @Basic
    @Column(name = "login_from")
    public Byte getLoginFrom() {
        return loginFrom;
    }

    public void setLoginFrom(Byte loginFrom) {
        this.loginFrom = loginFrom;
    }

    @Basic
    @Column(name = "login_num")
    public Integer getLoginNum() {
        return loginNum;
    }

    public void setLoginNum(Integer loginNum) {
        this.loginNum = loginNum;
    }

    @Basic
    @Column(name = "state")
    public Byte getState() {
        return state;
    }

    public void setState(Byte state) {
        this.state = state;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        AppUser appUser = (AppUser) o;
        return Objects.equal(getId(), appUser.getId()) &&
                Objects.equal(getMobile(), appUser.getMobile()) &&
                Objects.equal(getOpenId(), appUser.getOpenId()) &&
                Objects.equal(getIdcard(), appUser.getIdcard()) &&
                Objects.equal(getNickName(), appUser.getNickName()) &&
                Objects.equal(getBirthday(), appUser.getBirthday()) &&
                Objects.equal(getSex(), appUser.getSex()) &&
                Objects.equal(getAvatar(), appUser.getAvatar()) &&
                Objects.equal(getRegisterFrom(), appUser.getRegisterFrom()) &&
                Objects.equal(getRegisterTime(), appUser.getRegisterTime()) &&
                Objects.equal(getLoginTime(), appUser.getLoginTime()) &&
                Objects.equal(getLastLoginTime(), appUser.getLastLoginTime()) &&
                Objects.equal(getLoginIp(), appUser.getLoginIp()) &&
                Objects.equal(getLastLoginIp(), appUser.getLastLoginIp()) &&
                Objects.equal(getLoginFrom(), appUser.getLoginFrom()) &&
                Objects.equal(getLoginNum(), appUser.getLoginNum()) &&
                Objects.equal(getState(), appUser.getState());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(super.hashCode(), getId(), getMobile(), getOpenId(), getIdcard(), getNickName(), getBirthday(), getSex(), getAvatar(), getRegisterFrom(), getRegisterTime(), getLoginTime(), getLastLoginTime(), getLoginIp(), getLastLoginIp(), getLoginFrom(), getLoginNum(), getState());
    }

    @Override
    public String toString() {
        return "AppUser{" +
                "id=" + id +
                ", mobile='" + mobile + '\'' +
                ", openId='" + openId + '\'' +
                ", idcard='" + idcard + '\'' +
                ", nickName='" + nickName + '\'' +
                ", birthday=" + birthday +
                ", sex=" + sex +
                ", avatar='" + avatar + '\'' +
                ", registerFrom=" + registerFrom +
                ", registerTime=" + registerTime +
                ", loginTime=" + loginTime +
                ", lastLoginTime=" + lastLoginTime +
                ", loginIp='" + loginIp + '\'' +
                ", lastLoginIp='" + lastLoginIp + '\'' +
                ", loginFrom=" + loginFrom +
                ", loginNum=" + loginNum +
                ", state=" + state +
                '}';
    }
}
